//
// Created by wenyaxi on 24-10-30.
//
#include <common.h>
class Solution {
public:
    string addStrings(string num1, string num2) {
        int m = num1.length(), n = num2.length();
        int max_len=max(m,n);
        vector v1(max_len,0);
        vector v2(max_len,0);
        vector v3(max_len,0);
        for(int i=0;i<m;i++) {
            v1[i] = num1[m-i-1] - '0';
        }
        for(int i=0;i<n;i++) {
            v2[i] = num2[n-i-1] - '0';
        }
        int c=0;
        for(int i=0;i<max_len;i++) {
            int a=v1[i];
            int b=v2[i];
            int sum=a+b+c;
            v3[i] = sum%10;
            c=sum/10;
        }
        if(c>0) {
            v3.push_back(c);
        }
        stringstream ss;
        for(int i=v3.size()-1;i>=0;i--) {
            ss<<v3[i];
        }
        return ss.str();
    }
};
int main() {
    Solution s;
    /*
    "11"
    "123"
    "456"
    "77"
    "0"
    "0"
    */
    auto basic_string = s.addStrings("1234","9876");
    cout<<basic_string<<endl;
    return 0;
}